<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script src='../vue.js'></script>
</head>

<body>
    <div id='app'>
        父组件的数据：{{msg}}
        <hr>
        <mycom v-model:message="msg"></mycom>
    </div>
</body>
<template id="mycom">
    <div>
        子组件的数据：
        <input v-model="title" type="text">
    </div>
</template>
<script>
    const mycom = {
        template: '#mycom',
        props: ['message'],
        data() {
            return {

            }
        },
        methods: {},
        computed:{
            title:{
                get(){
                    return this.message
                },
                set(val){
                    this.$emit('update:message',val)
                }
            }
        }
    }
    const app = {
        data() {
            return {
                msg:"",
            }
        },
        methods: {},
        components:{
            mycom
        }
    }
    const vm = Vue.createApp(app).mount('#app')
</script>

</html>